package com.iyanbao;

import java.net.URLDecoder;
import java.net.URLEncoder;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

import com.iyanbao.utils.Base64;
import com.iyanbao.utils.MyUtil;
import com.iyanbao.webapi.WebAPIException;
import com.iyanbao.webapi.WebAPIRequestTask;
import com.iyanbao.webapi.WebRequest;
import com.iyanbao.webapi.WebResponse;
import com.iyanbao.webapi.task.IybCallBack;

public class IYanbaoActivity extends BasicAct {
    /** Called when the activity is first created. */
	
    IybCallBack cb = new IybCallBack(this){
    	public void onFinished(WebResponse result) {
    		super.onFinished(result);
    		MyUtil.log("web", "resutl::"+result.res);
    		MyUtil.log("web", "resutl unlock::"+Base64.unLockBase64(result.res));
    		MyUtil.log("web", "resutl unlock  decode::"+	URLDecoder.decode(Base64.unLockBase64(result.res)));
    		
    		
    	};
    	
    	public void onException(WebAPIException e) {
    		super.onException(e);
    		MyUtil.log("web", "error::"+e.code);
    	};
    };
	
    TextView tv;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        tv = (TextView)findViewById(R.id.textview);
        
        
        
        
       new WebAPIRequestTask(cb) {
		
		@Override
		public WebRequest getRequest() {
			// TODO Auto-generated method stub
			return new WebRequest(
					null,
					//"http://www.iyanbao.cn/ajax/search",
					"http://www.iyanbao.cn/ajax/index",
					true);
		}
	}.execute(null);
        
        
        
        
    }
    
    
	@Override
	public void showPage() {
		// TODO Auto-generated method stub
		
	}


	@Override
	public void handleBackAction() {
		// TODO Auto-generated method stub
		
	}
    
    

}